package qldc.pm.qlktcsdldc.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import qldc.pm.qlktcsdldc.model.DanhMucSoBanNganh_TruongCongDan;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import java.util.Date;

/**
 * The cache model class for representing DanhMucSoBanNganh_TruongCongDan in entity cache.
 *
 * @author Brian Wing Shun Chan
 * @see DanhMucSoBanNganh_TruongCongDan
 * @generated
 */
public class DanhMucSoBanNganh_TruongCongDanCacheModel implements CacheModel<DanhMucSoBanNganh_TruongCongDan>,
    Externalizable {
    public long IDDanhMucSoBanNganh_TruongCongDan;
    public long groupId;
    public long companyId;
    public long userId;
    public String userName;
    public long createDate;
    public long modifiedDate;
    public long IDQLKT_DanhMucSoBanNganh;
    public long IDDMDC_TruongCongDan;

    @Override
    public String toString() {
        StringBundler sb = new StringBundler(19);

        sb.append("{IDDanhMucSoBanNganh_TruongCongDan=");
        sb.append(IDDanhMucSoBanNganh_TruongCongDan);
        sb.append(", groupId=");
        sb.append(groupId);
        sb.append(", companyId=");
        sb.append(companyId);
        sb.append(", userId=");
        sb.append(userId);
        sb.append(", userName=");
        sb.append(userName);
        sb.append(", createDate=");
        sb.append(createDate);
        sb.append(", modifiedDate=");
        sb.append(modifiedDate);
        sb.append(", IDQLKT_DanhMucSoBanNganh=");
        sb.append(IDQLKT_DanhMucSoBanNganh);
        sb.append(", IDDMDC_TruongCongDan=");
        sb.append(IDDMDC_TruongCongDan);
        sb.append("}");

        return sb.toString();
    }

    @Override
    public DanhMucSoBanNganh_TruongCongDan toEntityModel() {
        DanhMucSoBanNganh_TruongCongDanImpl danhMucSoBanNganh_TruongCongDanImpl = new DanhMucSoBanNganh_TruongCongDanImpl();

        danhMucSoBanNganh_TruongCongDanImpl.setIDDanhMucSoBanNganh_TruongCongDan(IDDanhMucSoBanNganh_TruongCongDan);
        danhMucSoBanNganh_TruongCongDanImpl.setGroupId(groupId);
        danhMucSoBanNganh_TruongCongDanImpl.setCompanyId(companyId);
        danhMucSoBanNganh_TruongCongDanImpl.setUserId(userId);

        if (userName == null) {
            danhMucSoBanNganh_TruongCongDanImpl.setUserName(StringPool.BLANK);
        } else {
            danhMucSoBanNganh_TruongCongDanImpl.setUserName(userName);
        }

        if (createDate == Long.MIN_VALUE) {
            danhMucSoBanNganh_TruongCongDanImpl.setCreateDate(null);
        } else {
            danhMucSoBanNganh_TruongCongDanImpl.setCreateDate(new Date(
                    createDate));
        }

        if (modifiedDate == Long.MIN_VALUE) {
            danhMucSoBanNganh_TruongCongDanImpl.setModifiedDate(null);
        } else {
            danhMucSoBanNganh_TruongCongDanImpl.setModifiedDate(new Date(
                    modifiedDate));
        }

        danhMucSoBanNganh_TruongCongDanImpl.setIDQLKT_DanhMucSoBanNganh(IDQLKT_DanhMucSoBanNganh);
        danhMucSoBanNganh_TruongCongDanImpl.setIDDMDC_TruongCongDan(IDDMDC_TruongCongDan);

        danhMucSoBanNganh_TruongCongDanImpl.resetOriginalValues();

        return danhMucSoBanNganh_TruongCongDanImpl;
    }

    @Override
    public void readExternal(ObjectInput objectInput) throws IOException {
        IDDanhMucSoBanNganh_TruongCongDan = objectInput.readLong();
        groupId = objectInput.readLong();
        companyId = objectInput.readLong();
        userId = objectInput.readLong();
        userName = objectInput.readUTF();
        createDate = objectInput.readLong();
        modifiedDate = objectInput.readLong();
        IDQLKT_DanhMucSoBanNganh = objectInput.readLong();
        IDDMDC_TruongCongDan = objectInput.readLong();
    }

    @Override
    public void writeExternal(ObjectOutput objectOutput)
        throws IOException {
        objectOutput.writeLong(IDDanhMucSoBanNganh_TruongCongDan);
        objectOutput.writeLong(groupId);
        objectOutput.writeLong(companyId);
        objectOutput.writeLong(userId);

        if (userName == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(userName);
        }

        objectOutput.writeLong(createDate);
        objectOutput.writeLong(modifiedDate);
        objectOutput.writeLong(IDQLKT_DanhMucSoBanNganh);
        objectOutput.writeLong(IDDMDC_TruongCongDan);
    }
}
